﻿using Unity.Burst;
using Unity.Entities;
using UnityEngine;

namespace Assets.FlowField.Systems
{
    [UpdateAfter(typeof(GridColorModifySystem2))]
    public partial class GridColorModifySystem : SystemBase
    {
        [BurstDiscard]
        protected override void OnUpdate()
        {
            //Debug.Log($"{UnityEngine.Time.frameCount} -s-s-s-s-");
            //Entities.WithAll<SpriteRenderer>().WithoutBurst().ForEach((Entity entity, SpriteRenderer sprite) =>
            //{
            //    //sprite.color = new Color(entity.Index / 2560f, 0,0,1f);
            //    //sprite.color = new Color((float)SystemAPI.Time.ElapsedTime * (entity.Index % 2 + 1) % 1.0f, 0, 0, 1);
            //    //Debug.Log($"sprite:{sprite.name} frameCount:{UnityEngine.Time.frameCount} {Thread.CurrentThread.ManagedThreadId}");
            //}).Run();
        }
    }

    public partial class GridColorModifySystem2 : SystemBase
    {
        protected override void OnUpdate()
        {
            //Debug.Log($"{UnityEngine.Time.frameCount} -s-s-s-s-22");
        }
    }

    //[UpdateInGroup(typeof(Unity.Entities.BakingSystemGroup))]
    //public partial class UpdateInBakingSystemGroup : SystemBase
    //{
    //    protected override void OnUpdate()
    //    {
    //        Debug.Log($"frameCount:{UnityEngine.Time.frameCount} \t BakingSystemGroup");
    //    }
    //}

    //[UpdateInGroup(typeof(Unity.Entities.PreBakingSystemGroup))]
    //public partial class UpdateInPreBakingSystemGroup : SystemBase
    //{
    //    protected override void OnUpdate()
    //    {
    //        Debug.Log($"frameCount:{UnityEngine.Time.frameCount} \t PreBakingSystemGroup");
    //    }
    //}

    //[UpdateInGroup(typeof(Unity.Entities.PostBakingSystemGroup))]
    //public partial class UpdateInPostBakingSystemGroup : SystemBase
    //{
    //    protected override void OnUpdate()
    //    {
    //        Debug.Log($"frameCount:{UnityEngine.Time.frameCount} \t PostBakingSystemGroup");
    //    }
    //}

    //[UpdateInGroup(typeof(Unity.Entities.TransformBakingSystemGroup))]
    //public partial class UpdateInTransformBakingSystemGroup : SystemBase
    //{
    //    protected override void OnUpdate()
    //    {
    //        Debug.Log($"frameCount:{UnityEngine.Time.frameCount} \t TransformBakingSystemGroup");
    //    }
    //}

    //[UpdateInGroup(typeof(Unity.Entities.ConversionSetupGroup))]
    //public partial class UpdateInConversionSetupGroup : SystemBase
    //{
    //    protected override void OnUpdate()
    //    {
    //        Debug.Log($"frameCount:{UnityEngine.Time.frameCount} \t ConversionSetupGroup");
    //    }
    //}

    //[UpdateInGroup(typeof(Unity.Entities.FixedStepSimulationSystemGroup))]
    //public partial class UpdateInFixedStepSimulationSystemGroup : SystemBase
    //{
    //    protected override void OnUpdate()
    //    {
    //        Debug.Log($"frameCount:{UnityEngine.Time.frameCount} \t FixedStepSimulationSystemGroup");
    //    }
    //}

    //[UpdateInGroup(typeof(Unity.Entities.SimulationSystemGroup))]
    //public partial class UpdateInSimulationSystemGroup : SystemBase
    //{
    //    protected override void OnUpdate()
    //    {
    //        Debug.Log($"frameCount:{UnityEngine.Time.frameCount} \t SimulationSystemGroup");
    //    }
    //}
}